import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import menu from './modules/menu'
import user from './modules/user'

Vue.use(Vuex)

const store = new Vuex.Store({
  // 注册模块
  modules: {
    app,
    settings,
    menu,
    user
  },
  state: {},
  mutations: {},
  actions: {},
  getters: {
    sidebar: state => state.app.sidebar,
    device: state => state.app.device,
    username(state) {
      return state.user.userInfo.username
    },
    // staffPhoto(state) {
    //   return state.user.userInfo.staffPhoto
    // },
    // staffPhoto: function(state) {
    //   return state.user.userInfo.staffPhoto
    // },
    // staffPhoto: (state) => {
    //   return state.user.userInfo.staffPhoto
    // },
    staffPhoto: state => state.user.userInfo.staffPhoto
  }
})

export default store
